#include <stdio.h>

#include <ql_usbcfg.h>

int main(int argc, char* argv[])
{
    int mode = 0;
    uint8_t usbnet = 0;
    if (ql_usb_init_precondition()) {
        printf("ql_usb_init_precondition fail.\n");
        return 0;
    }
    while(1) {
        printf("1. set usbnet.\n");
        printf("2. get usbnet.\n");
        printf("-1. exit.\n");

        printf("pls input mode:");
        scanf("%d", &mode);

        switch (mode)
        {
            case 1:
                printf("pls input usbnet type:");
                scanf("%d", &usbnet);
                if (ql_usbnet_set(usbnet)) {
                    printf("set usbnet fail.\n");
                } else {
                    printf("set usbnet = %d success.\n", usbnet);
                }
                break;
            
            case 2:
                if (ql_usbnet_get(&usbnet)) {
                    printf("get usbnet fail.\n");
                } else {
                    printf("usbnet = %d.\n", usbnet);
                    printf("get usbnet success.\n");
                }
                break;
            case -1:
                return 0;
                
            default:
                break;
        }
    }
}
